<html>
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>小图变大图</title>
    <style>
        ul {
            padding: 0;
            margin: 50px auto;
            width: 400px;
            height: 450px;
            list-style: none;
        }
        section{
            width:300px;
            height:300px;
            float:left;
            background-size: 100% 100%;
        }
        img {
            width:100px;
            height:75px;
        }
        li{
            width:100px;
            height:75px;
            float:left;
        }
        .small {
            width: 100px;
            height: 75px;
            float: left; 
        }
    </style>
</head>
<body>
    <ul>
        <section class="big"></section>
        <div>
            <li><img src="帅0.jpg" alt="#" class="small"></li>
            <li><img src="帅1.jpg" alt="#" class="small"></li>
            <li><img src="帅2.jpg" alt="#" class="small"></li>
            <li><img src="帅3.jpg" alt="#" class="small"></li>
            <li><img src="帅4.jpg" alt="#" class="small"></li>
            <li><img src="帅5.jpg" alt="#" class="small"></li>
            <li><img src="帅6.jpg" alt="#" class="small"></li>
            <li><img src="帅7.jpg" alt="#" class="small"></li>
            <li><img src="帅8.jpg" alt="#" class="small"></li>
            <li><img src="帅9.jpg" alt="#" class="small"></li>
            <li><img src="帅10.jpg" alt="#" class="small"></li>
            <li><img src="帅11.jpg" alt="#" class="small"></li>
        </div>
    </ul>
</body>
</html>
<script>
  var arr=["url(帅0.jpg)","url(帅1.jpg)","url(帅2.jpg)","url(帅3.jpg)","url(帅4.jpg)","url(帅5.jpg)","url(帅7.jpg)","url(帅8.jpg)","url(帅9.jpg)","url(帅10.jpg)","url(帅11.jpg)"];
   console.log(arr);
  var small = document.querySelectorAll(".small");
  var big = document.querySelector(".big");
//   console.log(small);
  for(i=0;i<small.length;i++){
    //   console.log(small[i]);
      small[i].index=i;
      small[i].onmouseover=function(){
        //   console.log(this.index);
        //   console.log(arr[index]);
       
      big.style.backgroundImage=arr[this.index];
      }
  }
</script>


